package com.lottery.game.core.modules.service.game.impl;

import com.github.pagehelper.Page;
import com.lottery.game.common.base.service.impl.AbstractBaseServiceImpl;
import com.lottery.game.common.model.PageInfo;
import com.lottery.game.common.utils.StringUtil;
import com.lottery.game.core.model.dto.game.GameRoomTO;
import com.lottery.game.core.model.dto.game.query.RoomQuery;
import com.lottery.game.core.modules.entity.game.GameRoomV2;
import com.lottery.game.core.modules.service.game.GameRoomV2Service;

import org.springframework.stereotype.Service;

@Service("gameRoomV2Service")
public class GameRoomV2ServiceImpl extends AbstractBaseServiceImpl<GameRoomV2> implements GameRoomV2Service {
    @Override
    public PageInfo<GameRoomTO> query(RoomQuery roomQuery) {
        roomQuery.pageStart();
        GameRoomV2 param = new GameRoomV2();
        //彩票种类
        String roomLotteryTicketType = roomQuery.getRoomLotteryTicketType();
        if (StringUtil.isNotEmpty(roomLotteryTicketType)){
            param.setRoomLotteryTicketType(roomLotteryTicketType);
        }
        Page<GameRoomV2> roomV2s = (Page<GameRoomV2>) select(param);
        return PageInfo.valueOf(roomV2s, GameRoomTO.class);
    }
}
